3.1.66 \(\int (c+d \tan (e+f x))^3 (A+B \tan (e+f x)+C \tan ^2(e+f x)) \, dx\) [66]

3.1.66.1 Optimal result
3.1.66.2 Mathematica [C] (verified)
3.1.66.3 Rubi [A] (verified)
3.1.66.4 Maple [A] (verified)
3.1.66.5 Fricas [A] (verification not implemented)
3.1.66.6 Sympy [B] (verification not implemented)
3.1.66.7 Maxima [A] (verification not implemented)
3.1.66.8 Giac [B] (verification not implemented)
3.1.66.9 Mupad [B] (verification not implemented)

3.1.66.1 Optimal result

Integrand size = 33, antiderivative size = 191 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=-\left (\left (c^3 C+3 B c^2 d-3 c C d^2-B d^3-A \left (c^3-3 c d^2\right )\right ) x\right )-\frac {\left ((A-C) d \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {d \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {(B c+(A-C) d) (c+d \tan (e+f x))^2}{2 f}+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f} \]

output
-(c^3*C+3*B*c^2*d-3*C*c*d^2-B*d^3-A*(c^3-3*c*d^2))*x-((A-C)*d*(3*c^2-d^2)+ 
B*(c^3-3*c*d^2))*ln(cos(f*x+e))/f+d*(2*c*(A-C)*d+B*(c^2-d^2))*tan(f*x+e)/f 
+1/2*(B*c+(A-C)*d)*(c+d*tan(f*x+e))^2/f+1/3*B*(c+d*tan(f*x+e))^3/f+1/4*C*( 
c+d*tan(f*x+e))^4/d/f
 
3.1.66.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 2.61 (sec) , antiderivative size = 212, normalized size of antiderivative = 1.11 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {3 C (c+d \tan (e+f x))^4-6 (B c+(-A+C) d) \left ((i c-d)^3 \log (i-\tan (e+f x))-(i c+d)^3 \log (i+\tan (e+f x))+6 c d^2 \tan (e+f x)+d^3 \tan ^2(e+f x)\right )+2 B \left (-3 i (c+i d)^4 \log (i-\tan (e+f x))+3 i (c-i d)^4 \log (i+\tan (e+f x))-6 d^2 \left (-6 c^2+d^2\right ) \tan (e+f x)+12 c d^3 \tan ^2(e+f x)+2 d^4 \tan ^3(e+f x)\right )}{12 d f} \]

input
Integrate[(c + d*Tan[e + f*x])^3*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2),x 
]
 
output
(3*C*(c + d*Tan[e + f*x])^4 - 6*(B*c + (-A + C)*d)*((I*c - d)^3*Log[I - Ta 
n[e + f*x]] - (I*c + d)^3*Log[I + Tan[e + f*x]] + 6*c*d^2*Tan[e + f*x] + d 
^3*Tan[e + f*x]^2) + 2*B*((-3*I)*(c + I*d)^4*Log[I - Tan[e + f*x]] + (3*I) 
*(c - I*d)^4*Log[I + Tan[e + f*x]] - 6*d^2*(-6*c^2 + d^2)*Tan[e + f*x] + 1 
2*c*d^3*Tan[e + f*x]^2 + 2*d^4*Tan[e + f*x]^3))/(12*d*f)
 
3.1.66.3 Rubi [A] (verified)

Time = 0.83 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.303, Rules used = {3042, 4113, 3042, 4011, 3042, 4011, 3042, 4008, 3042, 3956}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan (e+f x)^2\right )dx\)

\(\Big \downarrow \) 4113

\(\displaystyle \int (A-C+B \tan (e+f x)) (c+d \tan (e+f x))^3dx+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (A-C+B \tan (e+f x)) (c+d \tan (e+f x))^3dx+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (c+d \tan (e+f x))^2 (A c-C c-B d+(B c+(A-C) d) \tan (e+f x))dx+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (c+d \tan (e+f x))^2 (A c-C c-B d+(B c+(A-C) d) \tan (e+f x))dx+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (c+d \tan (e+f x)) \left (-C c^2-2 B d c+C d^2+A \left (c^2-d^2\right )+\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \tan (e+f x)\right )dx+\frac {(d (A-C)+B c) (c+d \tan (e+f x))^2}{2 f}+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (c+d \tan (e+f x)) \left (-C c^2-2 B d c+C d^2+A \left (c^2-d^2\right )+\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \tan (e+f x)\right )dx+\frac {(d (A-C)+B c) (c+d \tan (e+f x))^2}{2 f}+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 4008

\(\displaystyle \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right ) \int \tan (e+f x)dx+\frac {d \tan (e+f x) \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )}{f}-x \left (-A \left (c^3-3 c d^2\right )+3 B c^2 d-B d^3+c^3 C-3 c C d^2\right )+\frac {(d (A-C)+B c) (c+d \tan (e+f x))^2}{2 f}+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right ) \int \tan (e+f x)dx+\frac {d \tan (e+f x) \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )}{f}-x \left (-A \left (c^3-3 c d^2\right )+3 B c^2 d-B d^3+c^3 C-3 c C d^2\right )+\frac {(d (A-C)+B c) (c+d \tan (e+f x))^2}{2 f}+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {d \tan (e+f x) \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )}{f}-\frac {\left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right ) \log (\cos (e+f x))}{f}-x \left (-A \left (c^3-3 c d^2\right )+3 B c^2 d-B d^3+c^3 C-3 c C d^2\right )+\frac {(d (A-C)+B c) (c+d \tan (e+f x))^2}{2 f}+\frac {B (c+d \tan (e+f x))^3}{3 f}+\frac {C (c+d \tan (e+f x))^4}{4 d f}\)

input
Int[(c + d*Tan[e + f*x])^3*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2),x]
 
output
-((c^3*C + 3*B*c^2*d - 3*c*C*d^2 - B*d^3 - A*(c^3 - 3*c*d^2))*x) - (((A - 
C)*d*(3*c^2 - d^2) + B*(c^3 - 3*c*d^2))*Log[Cos[e + f*x]])/f + (d*(2*c*(A 
- C)*d + B*(c^2 - d^2))*Tan[e + f*x])/f + ((B*c + (A - C)*d)*(c + d*Tan[e 
+ f*x])^2)/(2*f) + (B*(c + d*Tan[e + f*x])^3)/(3*f) + (C*(c + d*Tan[e + f* 
x])^4)/(4*d*f)
 

3.1.66.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 

rule 4113
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*((a + 
 b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Si 
mp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && 
NeQ[A*b^2 - a*b*B + a^2*C, 0] &&  !LeQ[m, -1]
 
3.1.66.4 Maple [A] (verified)

Time = 0.11 (sec) , antiderivative size = 210, normalized size of antiderivative = 1.10

method result size
parts \(A \,c^{3} x +\frac {\left (3 A \,c^{2} d +B \,c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (B \,d^{3}+3 C c \,d^{2}\right ) \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (A \,d^{3}+3 B c \,d^{2}+3 C \,c^{2} d \right ) \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {\left (3 A c \,d^{2}+3 B \,c^{2} d +c^{3} C \right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {C \,d^{3} \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}\) \(210\)
norman \(\left (A \,c^{3}-3 A c \,d^{2}-3 B \,c^{2} d +B \,d^{3}-c^{3} C +3 C c \,d^{2}\right ) x +\frac {\left (3 A c \,d^{2}+3 B \,c^{2} d -B \,d^{3}+c^{3} C -3 C c \,d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {C \,d^{3} \tan \left (f x +e \right )^{4}}{4 f}+\frac {d \left (A \,d^{2}+3 B c d +3 c^{2} C -C \,d^{2}\right ) \tan \left (f x +e \right )^{2}}{2 f}+\frac {d^{2} \left (B d +3 C c \right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {\left (3 A \,c^{2} d -A \,d^{3}+B \,c^{3}-3 B c \,d^{2}-3 C \,c^{2} d +C \,d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) \(217\)
derivativedivides \(\frac {\frac {C \,d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {B \,d^{3} \tan \left (f x +e \right )^{3}}{3}+C c \,d^{2} \tan \left (f x +e \right )^{3}+\frac {A \,d^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {3 B c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\frac {3 C \,c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {C \,d^{3} \tan \left (f x +e \right )^{2}}{2}+3 \tan \left (f x +e \right ) A c \,d^{2}+3 \tan \left (f x +e \right ) B \,c^{2} d -\tan \left (f x +e \right ) B \,d^{3}+\tan \left (f x +e \right ) c^{3} C -3 \tan \left (f x +e \right ) C c \,d^{2}+\frac {\left (3 A \,c^{2} d -A \,d^{3}+B \,c^{3}-3 B c \,d^{2}-3 C \,c^{2} d +C \,d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A \,c^{3}-3 A c \,d^{2}-3 B \,c^{2} d +B \,d^{3}-c^{3} C +3 C c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(265\)
default \(\frac {\frac {C \,d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {B \,d^{3} \tan \left (f x +e \right )^{3}}{3}+C c \,d^{2} \tan \left (f x +e \right )^{3}+\frac {A \,d^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {3 B c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\frac {3 C \,c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {C \,d^{3} \tan \left (f x +e \right )^{2}}{2}+3 \tan \left (f x +e \right ) A c \,d^{2}+3 \tan \left (f x +e \right ) B \,c^{2} d -\tan \left (f x +e \right ) B \,d^{3}+\tan \left (f x +e \right ) c^{3} C -3 \tan \left (f x +e \right ) C c \,d^{2}+\frac {\left (3 A \,c^{2} d -A \,d^{3}+B \,c^{3}-3 B c \,d^{2}-3 C \,c^{2} d +C \,d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A \,c^{3}-3 A c \,d^{2}-3 B \,c^{2} d +B \,d^{3}-c^{3} C +3 C c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(265\)
parallelrisch \(\frac {3 C \,d^{3} \tan \left (f x +e \right )^{4}+4 B \,d^{3} \tan \left (f x +e \right )^{3}+6 A \,d^{3} \tan \left (f x +e \right )^{2}-6 C \,d^{3} \tan \left (f x +e \right )^{2}-12 \tan \left (f x +e \right ) B \,d^{3}+12 \tan \left (f x +e \right ) c^{3} C +18 C \,c^{2} d \tan \left (f x +e \right )^{2}+36 \tan \left (f x +e \right ) A c \,d^{2}+36 \tan \left (f x +e \right ) B \,c^{2} d -36 \tan \left (f x +e \right ) C c \,d^{2}+12 C c \,d^{2} \tan \left (f x +e \right )^{3}+18 B c \,d^{2} \tan \left (f x +e \right )^{2}+18 A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) c^{2} d -18 B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) c \,d^{2}+12 A \,c^{3} f x +12 B \,d^{3} f x -12 C \,c^{3} f x -6 A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) d^{3}+6 B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) c^{3}+6 C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) d^{3}-36 B \,c^{2} d f x +36 C c \,d^{2} f x -36 A c \,d^{2} f x -18 C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) c^{2} d}{12 f}\) \(327\)
risch \(A \,c^{3} x +B \,d^{3} x -C \,c^{3} x +\frac {2 i \left (9 A c \,d^{2}-12 C c \,d^{2}+9 B \,c^{2} d -4 B \,d^{3}+3 c^{3} C -36 C c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+27 A c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+27 B \,c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}-30 C c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+9 A c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}+9 B \,c^{2} d \,{\mathrm e}^{6 i \left (f x +e \right )}-18 C c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}+27 A c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+27 B \,c^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i A \,d^{3} {\mathrm e}^{2 i \left (f x +e \right )}+6 i C \,d^{3} {\mathrm e}^{2 i \left (f x +e \right )}-3 i A \,d^{3} {\mathrm e}^{6 i \left (f x +e \right )}+6 i C \,d^{3} {\mathrm e}^{6 i \left (f x +e \right )}-6 i A \,d^{3} {\mathrm e}^{4 i \left (f x +e \right )}+6 i C \,d^{3} {\mathrm e}^{4 i \left (f x +e \right )}+9 C \,c^{3} {\mathrm e}^{4 i \left (f x +e \right )}-10 B \,d^{3} {\mathrm e}^{2 i \left (f x +e \right )}+9 C \,c^{3} {\mathrm e}^{2 i \left (f x +e \right )}-6 B \,d^{3} {\mathrm e}^{6 i \left (f x +e \right )}+3 C \,c^{3} {\mathrm e}^{6 i \left (f x +e \right )}-12 B \,d^{3} {\mathrm e}^{4 i \left (f x +e \right )}-9 i C \,c^{2} d \,{\mathrm e}^{6 i \left (f x +e \right )}-18 i B c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-18 i C \,c^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}-9 i B c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-9 i C \,c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}-9 i B c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A \,d^{3}}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B \,c^{3}}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) C \,d^{3}}{f}-i A \,d^{3} x +i B \,c^{3} x +i C \,d^{3} x +\frac {6 i A \,c^{2} d e}{f}-\frac {6 i B c \,d^{2} e}{f}-\frac {6 i C \,c^{2} d e}{f}-3 A c \,d^{2} x -3 B \,c^{2} d x +3 C c \,d^{2} x -3 i B c \,d^{2} x -3 i C \,c^{2} d x +3 i A \,c^{2} d x -\frac {2 i A \,d^{3} e}{f}+\frac {2 i B \,c^{3} e}{f}+\frac {2 i C \,d^{3} e}{f}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A \,c^{2} d}{f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B c \,d^{2}}{f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) C \,c^{2} d}{f}\) \(778\)

input
int((c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x,method=_RETURNVER 
BOSE)
 
output
A*c^3*x+1/2*(3*A*c^2*d+B*c^3)/f*ln(1+tan(f*x+e)^2)+(B*d^3+3*C*c*d^2)/f*(1/ 
3*tan(f*x+e)^3-tan(f*x+e)+arctan(tan(f*x+e)))+(A*d^3+3*B*c*d^2+3*C*c^2*d)/ 
f*(1/2*tan(f*x+e)^2-1/2*ln(1+tan(f*x+e)^2))+(3*A*c*d^2+3*B*c^2*d+C*c^3)/f* 
(tan(f*x+e)-arctan(tan(f*x+e)))+C*d^3/f*(1/4*tan(f*x+e)^4-1/2*tan(f*x+e)^2 
+1/2*ln(1+tan(f*x+e)^2))
 
3.1.66.5 Fricas [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 201, normalized size of antiderivative = 1.05 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {3 \, C d^{3} \tan \left (f x + e\right )^{4} + 4 \, {\left (3 \, C c d^{2} + B d^{3}\right )} \tan \left (f x + e\right )^{3} + 12 \, {\left ({\left (A - C\right )} c^{3} - 3 \, B c^{2} d - 3 \, {\left (A - C\right )} c d^{2} + B d^{3}\right )} f x + 6 \, {\left (3 \, C c^{2} d + 3 \, B c d^{2} + {\left (A - C\right )} d^{3}\right )} \tan \left (f x + e\right )^{2} - 6 \, {\left (B c^{3} + 3 \, {\left (A - C\right )} c^{2} d - 3 \, B c d^{2} - {\left (A - C\right )} d^{3}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 12 \, {\left (C c^{3} + 3 \, B c^{2} d + 3 \, {\left (A - C\right )} c d^{2} - B d^{3}\right )} \tan \left (f x + e\right )}{12 \, f} \]

input
integrate((c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm= 
"fricas")
 
output
1/12*(3*C*d^3*tan(f*x + e)^4 + 4*(3*C*c*d^2 + B*d^3)*tan(f*x + e)^3 + 12*( 
(A - C)*c^3 - 3*B*c^2*d - 3*(A - C)*c*d^2 + B*d^3)*f*x + 6*(3*C*c^2*d + 3* 
B*c*d^2 + (A - C)*d^3)*tan(f*x + e)^2 - 6*(B*c^3 + 3*(A - C)*c^2*d - 3*B*c 
*d^2 - (A - C)*d^3)*log(1/(tan(f*x + e)^2 + 1)) + 12*(C*c^3 + 3*B*c^2*d + 
3*(A - C)*c*d^2 - B*d^3)*tan(f*x + e))/f
 
3.1.66.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 410 vs. \(2 (163) = 326\).

Time = 0.17 (sec) , antiderivative size = 410, normalized size of antiderivative = 2.15 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\begin {cases} A c^{3} x + \frac {3 A c^{2} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 A c d^{2} x + \frac {3 A c d^{2} \tan {\left (e + f x \right )}}{f} - \frac {A d^{3} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {A d^{3} \tan ^{2}{\left (e + f x \right )}}{2 f} + \frac {B c^{3} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 B c^{2} d x + \frac {3 B c^{2} d \tan {\left (e + f x \right )}}{f} - \frac {3 B c d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 B c d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} + B d^{3} x + \frac {B d^{3} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {B d^{3} \tan {\left (e + f x \right )}}{f} - C c^{3} x + \frac {C c^{3} \tan {\left (e + f x \right )}}{f} - \frac {3 C c^{2} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 C c^{2} d \tan ^{2}{\left (e + f x \right )}}{2 f} + 3 C c d^{2} x + \frac {C c d^{2} \tan ^{3}{\left (e + f x \right )}}{f} - \frac {3 C c d^{2} \tan {\left (e + f x \right )}}{f} + \frac {C d^{3} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {C d^{3} \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac {C d^{3} \tan ^{2}{\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (c + d \tan {\left (e \right )}\right )^{3} \left (A + B \tan {\left (e \right )} + C \tan ^{2}{\left (e \right )}\right ) & \text {otherwise} \end {cases} \]

input
integrate((c+d*tan(f*x+e))**3*(A+B*tan(f*x+e)+C*tan(f*x+e)**2),x)
 
output
Piecewise((A*c**3*x + 3*A*c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) - 3*A*c*d* 
*2*x + 3*A*c*d**2*tan(e + f*x)/f - A*d**3*log(tan(e + f*x)**2 + 1)/(2*f) + 
 A*d**3*tan(e + f*x)**2/(2*f) + B*c**3*log(tan(e + f*x)**2 + 1)/(2*f) - 3* 
B*c**2*d*x + 3*B*c**2*d*tan(e + f*x)/f - 3*B*c*d**2*log(tan(e + f*x)**2 + 
1)/(2*f) + 3*B*c*d**2*tan(e + f*x)**2/(2*f) + B*d**3*x + B*d**3*tan(e + f* 
x)**3/(3*f) - B*d**3*tan(e + f*x)/f - C*c**3*x + C*c**3*tan(e + f*x)/f - 3 
*C*c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) + 3*C*c**2*d*tan(e + f*x)**2/(2*f 
) + 3*C*c*d**2*x + C*c*d**2*tan(e + f*x)**3/f - 3*C*c*d**2*tan(e + f*x)/f 
+ C*d**3*log(tan(e + f*x)**2 + 1)/(2*f) + C*d**3*tan(e + f*x)**4/(4*f) - C 
*d**3*tan(e + f*x)**2/(2*f), Ne(f, 0)), (x*(c + d*tan(e))**3*(A + B*tan(e) 
 + C*tan(e)**2), True))
 
3.1.66.7 Maxima [A] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 202, normalized size of antiderivative = 1.06 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {3 \, C d^{3} \tan \left (f x + e\right )^{4} + 4 \, {\left (3 \, C c d^{2} + B d^{3}\right )} \tan \left (f x + e\right )^{3} + 6 \, {\left (3 \, C c^{2} d + 3 \, B c d^{2} + {\left (A - C\right )} d^{3}\right )} \tan \left (f x + e\right )^{2} + 12 \, {\left ({\left (A - C\right )} c^{3} - 3 \, B c^{2} d - 3 \, {\left (A - C\right )} c d^{2} + B d^{3}\right )} {\left (f x + e\right )} + 6 \, {\left (B c^{3} + 3 \, {\left (A - C\right )} c^{2} d - 3 \, B c d^{2} - {\left (A - C\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 12 \, {\left (C c^{3} + 3 \, B c^{2} d + 3 \, {\left (A - C\right )} c d^{2} - B d^{3}\right )} \tan \left (f x + e\right )}{12 \, f} \]

input
integrate((c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm= 
"maxima")
 
output
1/12*(3*C*d^3*tan(f*x + e)^4 + 4*(3*C*c*d^2 + B*d^3)*tan(f*x + e)^3 + 6*(3 
*C*c^2*d + 3*B*c*d^2 + (A - C)*d^3)*tan(f*x + e)^2 + 12*((A - C)*c^3 - 3*B 
*c^2*d - 3*(A - C)*c*d^2 + B*d^3)*(f*x + e) + 6*(B*c^3 + 3*(A - C)*c^2*d - 
 3*B*c*d^2 - (A - C)*d^3)*log(tan(f*x + e)^2 + 1) + 12*(C*c^3 + 3*B*c^2*d 
+ 3*(A - C)*c*d^2 - B*d^3)*tan(f*x + e))/f
 
3.1.66.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 3720 vs. \(2 (185) = 370\).

Time = 3.19 (sec) , antiderivative size = 3720, normalized size of antiderivative = 19.48 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\text {Too large to display} \]

input
integrate((c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm= 
"giac")
 
output
1/12*(12*A*c^3*f*x*tan(f*x)^4*tan(e)^4 - 12*C*c^3*f*x*tan(f*x)^4*tan(e)^4 
- 36*B*c^2*d*f*x*tan(f*x)^4*tan(e)^4 - 36*A*c*d^2*f*x*tan(f*x)^4*tan(e)^4 
+ 36*C*c*d^2*f*x*tan(f*x)^4*tan(e)^4 + 12*B*d^3*f*x*tan(f*x)^4*tan(e)^4 - 
6*B*c^3*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*ta 
n(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 - 18*A*c^2*d*log( 
4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan 
(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 + 18*C*c^2*d*log(4*(tan(f*x)^ 
2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + ta 
n(e)^2 + 1))*tan(f*x)^4*tan(e)^4 + 18*B*c*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 
 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)) 
*tan(f*x)^4*tan(e)^4 + 6*A*d^3*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan 
(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan 
(e)^4 - 6*C*d^3*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f 
*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 - 48*A*c^ 
3*f*x*tan(f*x)^3*tan(e)^3 + 48*C*c^3*f*x*tan(f*x)^3*tan(e)^3 + 144*B*c^2*d 
*f*x*tan(f*x)^3*tan(e)^3 + 144*A*c*d^2*f*x*tan(f*x)^3*tan(e)^3 - 144*C*c*d 
^2*f*x*tan(f*x)^3*tan(e)^3 - 48*B*d^3*f*x*tan(f*x)^3*tan(e)^3 + 18*C*c^2*d 
*tan(f*x)^4*tan(e)^4 + 18*B*c*d^2*tan(f*x)^4*tan(e)^4 + 6*A*d^3*tan(f*x)^4 
*tan(e)^4 - 9*C*d^3*tan(f*x)^4*tan(e)^4 + 24*B*c^3*log(4*(tan(f*x)^2*tan(e 
)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)...
 
3.1.66.9 Mupad [B] (verification not implemented)

Time = 8.17 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.16 \[ \int (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=x\,\left (A\,c^3+B\,d^3-C\,c^3-3\,A\,c\,d^2-3\,B\,c^2\,d+3\,C\,c\,d^2\right )+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (C\,c^3-B\,d^3+3\,A\,c\,d^2+3\,B\,c^2\,d-3\,C\,c\,d^2\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {B\,d^3}{3}+C\,c\,d^2\right )}{f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {A\,d^3}{2}-\frac {B\,c^3}{2}-\frac {C\,d^3}{2}-\frac {3\,A\,c^2\,d}{2}+\frac {3\,B\,c\,d^2}{2}+\frac {3\,C\,c^2\,d}{2}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {A\,d^3}{2}-\frac {C\,d^3}{2}+\frac {3\,B\,c\,d^2}{2}+\frac {3\,C\,c^2\,d}{2}\right )}{f}+\frac {C\,d^3\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4\,f} \]

input
int((c + d*tan(e + f*x))^3*(A + B*tan(e + f*x) + C*tan(e + f*x)^2),x)
 
output
x*(A*c^3 + B*d^3 - C*c^3 - 3*A*c*d^2 - 3*B*c^2*d + 3*C*c*d^2) + (tan(e + f 
*x)*(C*c^3 - B*d^3 + 3*A*c*d^2 + 3*B*c^2*d - 3*C*c*d^2))/f + (tan(e + f*x) 
^3*((B*d^3)/3 + C*c*d^2))/f - (log(tan(e + f*x)^2 + 1)*((A*d^3)/2 - (B*c^3 
)/2 - (C*d^3)/2 - (3*A*c^2*d)/2 + (3*B*c*d^2)/2 + (3*C*c^2*d)/2))/f + (tan 
(e + f*x)^2*((A*d^3)/2 - (C*d^3)/2 + (3*B*c*d^2)/2 + (3*C*c^2*d)/2))/f + ( 
C*d^3*tan(e + f*x)^4)/(4*f)